Re: [SQL] optimizing 2-table join w/millions of rows - Mailing list pgsql-sql

From Herouth Maoz
Subject Re: [SQL] optimizing 2-table join w/millions of rows
Date
Msg-id l03110700b27da28b94ff@[147.233.159.109]
Whole thread Raw
In response to optimizing 2-table join w/millions of rows  (Michael Olivier <molivier@yahoo.com>)
List pgsql-sql
At 4:26 +0200 on 20/11/98, Michael Olivier wrote:


>
> select U.acctname from usertest U, bgndtest B where
>     B.part_needed=3 and B.loc_needed=5 and
>     B.acctname=U.acctname and U.acctname in
>         (select acctname from usertest where part=2 and loc=3)

Can you explain *verbally* what you meant to do here? It seems as if the
subselect is redundant. How about:

SELECT U.acctname
FROM   usertest U, bgndtest B
WHERE  B.acctname = U.acctname
  AND  B.part_needed=3 AND B.loc_needed=5
  AND  U.part=2 AND U.loc=3;

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: How do I COPY empty Datetimes?
Next
From: Postgres DBA
Date:
Subject: Re: [SQL] Re: How do I COPY empty Datetimes?